package com.kingyun.gpsinspection.purificationservice.services.activitiservice.ext.configurator;


import org.activiti.bpmn.model.ActivitiListener;
import org.activiti.bpmn.model.ImplementationType;
import org.activiti.engine.cfg.AbstractProcessEngineConfigurator;
import org.activiti.engine.delegate.ExecutionListener;
import org.activiti.engine.impl.bpmn.parser.factory.ListenerFactory;
import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;

/**
 * 自定义流程配置器
 */
public class CustomerProcessEngineConfigurator extends AbstractProcessEngineConfigurator {

    @Override
    public void configure(ProcessEngineConfigurationImpl processEngineConfiguration) {
        ActivitiListener excutionListener=new ActivitiListener();
        excutionListener.setEvent(ExecutionListener.EVENTNAME_END);
        excutionListener.setImplementationType(ImplementationType.IMPLEMENTATION_TYPE_DELEGATEEXPRESSION);
        excutionListener.setImplementation("#{customerExcutionListener}");
        ListenerFactory listenerFactory = processEngineConfiguration.getListenerFactory();
        ExecutionListener expressionExecutionListener = listenerFactory.createExpressionExecutionListener(excutionListener);

        super.configure(processEngineConfiguration);
    }
}
